@extends('admin.common.admin')
@section('cnt')
    {{-- 面包屑导航 --}}
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 管理员管理
        <span class="c-gray en">&gt;</span> 角色列表
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <div class="page-container">
        @include('admin.common.msg')

        <div class="text-c">
            <form>
                日期范围：
                <input type="text" value="{{ request()->get('datemin') }}" autocomplete="off" onfocus="WdatePicker({})"
                       name="datemin" class="input-text Wdate" style="width:120px;">
                -
                <input type="text" value="{{ request()->get('datemax') }}" autocomplete="off" onfocus="WdatePicker({})"
                       name="datemax" class="input-text Wdate" style="width:120px;">
                <input type="text" class="input-text" style="width:250px" value="{{ request()->get('username') }}"
                       placeholder="输入账号" name="username">
                <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i>
                    搜用户
                </button>
            </form>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <a onclick="datadel()" class="btn btn-danger radius">
                    <i class="Hui-iconfont">&#xe6e2;</i> 批量删除
                </a>
                <a href="{{ route('admin.role.create') }}" class="btn btn-primary radius">
                    <i class="Hui-iconfont">&#xe600;</i> 添加角色
                </a>
            </span>
            <span class="r">共有数据：<strong>{{ $data->total() }}</strong> 条</span></div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-hover table-bg table-sort">
                <thead>
                <tr class="text-c">
                    <th width="25"><input type="checkbox" name="" value=""></th>
                    <th width="80">ID</th>
                    <th width="100">角色名称</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr class="text-c">
                        <td><input type="checkbox" value="{{ $item->id }}" name="id[]"></td>
                        <td>{{ $item->id }}</td>
                        <td id="name_{{ $item->id }}">{{ $item->name }}</td>
                        <td class="td-manage">
                            <a href="{{ route('admin.role.auth',$item) }}" class="label label-success">分配权限</a>
                            <a href="{{ route('admin.role.edit',$item) }}" class="label label-primary editBtn">修改</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
        {{ $data->appends(request()->except('page'))->links() }}
    </div>
@endsection

@section('js')
    <script>
        $('.editBtn').click(function () {
            let url = $(this).attr('href');
            // 模态框发送ajax
            layer_show('修改角色', url, 800, 300);
            //阻止默认行为
            return false;
        })
    </script>
@endsection

